package cn.pli.bike.ui;

import android.support.v7.widget.RecyclerView;

import com.framemodule.utils.CommonUtils;

import cn.bingoogolapple.androidcommon.adapter.BGARecyclerViewAdapter;
import cn.bingoogolapple.androidcommon.adapter.BGAViewHolderHelper;
import cn.pli.bike.R;
import cn.pli.bike.bean.CreditRecord;
import cn.pli.bike.bean.ExpensesRecordBean;

/**
 * Created by shangdongzhou on 2017/11/19.
 */

public class JourneyDetailAdapter extends BGARecyclerViewAdapter<ExpensesRecordBean> {

    public JourneyDetailAdapter(RecyclerView recyclerView) {
        super(recyclerView, R.layout.item_journey_detail);
    }

    @Override
    protected void fillData(BGAViewHolderHelper helper, int position, ExpensesRecordBean model) {
        helper.getTextView(R.id.tv_journey_time).setText(CommonUtils.parseDateTime(model.getOrderTime()));
        helper.getTextView(R.id.tv_bike_number).setText(mContext.getString(R.string.bike_number) + model.getLockNumber());
        int time;
        long rideTime = model.getEndTime() - model.getBeginTime();
        if (rideTime < 0) {
            time = 1;
        } else {
            time = (int) (rideTime / (1000 * 60));
            time += 1;
        }

        helper.getTextView(R.id.tv_bike_ride_time_spend).setText("骑行时间:" + time + "分钟   " + "骑行花费：" + model.getExpensesAmount() + "元");

    }
}
